#include <iostream>
using namespace std;

class matrix
{
	public:
	int row;
	int col;
	int values[2][2];	
	
	matrix()
	{
	row=2;
	col=2;
	}

	void populate_matrix();
	void populate_matrix(int a, int b, int c, int d);
	void add(matrix,matrix);
	void subtract(matrix,matrix);
	void multiply(matrix,matrix);
	void display();

};

void matrix::populate_matrix()
{
   for ( int i = 0 ; i < row ; i++ )
      for (int j = 0 ; j < col ; j++ )
         cin >> values[i][j];
		cout << endl;	
}

void matrix::populate_matrix(int a,int b,int c,int d)
{
  
         values[0][0]=a;
         values[0][1]=b;
         values[1][0]=c;
         values[1][1]=d;
		cout << endl;	
}

void matrix::add(matrix matrix1 , matrix matrix2)
{
	   for ( int i = 0 ; i < row ; i++ )
      for (int j = 0 ; j < col ; j++ )
        values[i][j]=matrix1.values[i][j]+matrix2.values[i][j];
		cout << endl;
}

void matrix::subtract(matrix matrix1 , matrix matrix2)
{
	  for ( int i = 0 ; i < row ; i++ )
      for (int j = 0 ; j < col ; j++ )
 		values[i][j] = matrix1.values[i][j] - matrix2.values[i][j];	
}

void matrix::multiply(matrix matrix1 , matrix matrix2)
{
	for ( int i = 0 ; i < row ; i++ )
      for (int j = 0 ; j < col ; j++ )
	 values[i][j] = matrix1.values[i][j] * matrix2.values[i][j];
}

void matrix::display()
{
	   for ( int i = 0 ; i < row ; i++ )
      for (int j = 0 ; j < col ; j++ )
         cout << values[i][j];
		cout << endl;
}


